﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using sdm.exam.domain;

namespace sdm.exam.test
{
    [TestClass]
    public class SemesterCalcManagerTest
    {
        [TestMethod]
        public void CalculateSemesterTest()
        {
            var calcMan = new SemesterCalcManager();
            DateTime thisYear = DateTime.Now;
            int year = thisYear.Year;

            String newYear = "01/09/" + (year-2);

            DateTime oldYear = DateTime.Parse(newYear);

            int calcSemester = calcMan.CalculateSemester(oldYear);

            if(thisYear.Month < 9)
                Assert.AreEqual(4, calcSemester);
            else
                Assert.AreEqual(5, calcSemester);
        }
    }
}
